@extends('layouts.back_stage')
@section('content')
    <style>
        .shop_to_bom2{
            margin:0 5px 0 5px ;
        }
    </style>
<div class="head-box">
    <div class="head-title griard-head-title">
        <p>款号:<span>{{isset($_GET['girard'])?$_GET['girard']:''}}</span></p>
        <h5>品牌:<span>{{ $brand[$product[0]->brand] }}</span></h5>
        <h5>类型:<span>{{ $cate[$product[0]->cate2] }}</span></h5>
    </div>
</div>
<table border="1" cellspacing="0" class="griard-table">
    <thead>
    <tr>
        <th class="col-md-1">计划单号</th>
        <th class="col-md-1">颜色</th>
        <th class="col-md-1">预计出货时间</th>
        <th class="col-md-1">加工厂</th>
        <th class="col-md-1">负责人/联系电话</th>
        <th class="col-md-1">状态</th>
        <th class="col-md-1">操作</th>
    </tr>
    </thead>
    <tbody>
    @foreach($product as $k=>$v)
    <tr>
        <td class="col-md-1">{{ $v->plan_code }}</td>
        <td class="col-md-1">{{ $v->color }}</td>
        <td class="col-md-1">{{ $v->plan_date }}</td>
        <td class="col-md-1">{{ $v->plan_factory }}</td>
        <td class="col-md-1">{{ $v->user_name }} {{ $v->user_tel }}</td>
        <td class="col-md-1">
            @if($v->status == -1 )
                暂不生产
            @elseif(!$v->plan_code)
                采购中
            @endif
        </td>
        <td class="col-md-2">
            {{--<button class="btn btn-info showMask">查看</button>--}}
            <button class="btn btn-info shop_to_bom2" id="{{ $v->id }}">暂缓</button></td>
    </tr>
    @endforeach
    </tbody>
</table>
<div class="mask-box" onclick="closeMask()">
    <div class="girard_info_tost">
        <button class="close_mask">×</button>
        <table class="fab" border="1" cellspacing="0" cellpadding="0">
            <tr>
                <td>面料号</td><td>状态</td>
            </tr>
        </table>
    </div>
</div>
<script type="text/javascript">
    $('.showMask').click(function () {
        $('.mask-box').show();
    });
    function closeMask() {
        $('.mask-box').hide();
    }
    $('.shop_to_bom2').click(function () {
        var id = $(this).attr('id');
        var that_ =  $(this);
        $(".oText").text("确定要暂缓吗？这样会停止该颜色的款号进入BOM2.0，停止采购生产");
        $(".oMask").show();
        $(".oAnim").show();
        $(".oBtn0").attr('id','');
        $(".oBtn0").attr('id','oRefund');
        $(document).on('click','#oRefund',function(){
            $(".oMask").hide();
            $(".oAnim").hide();
            $.ajax({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                },
                type: 'post',
                url: '/ware_house/updateProStatus',
                dataType:'json',
                data: {
                    id:id,
                    status:-1
                },
                success:function (res) {
                    if(res.success){
                        $(".faceImg").attr("src","/img/laugh.png");
                        $(".oHandle").text("暂缓成功");
                        $(".oSuccess").show(0).delay(1000).hide(0);
                        that_.attr('disabled','disabled');
                    }else{
                        $(".faceImg").attr("src","/img/laugh.png");
                        $(".oHandle").text(res.info);
                        $(".oSuccess").show(0).delay(1000).hide(0);
                    }
                }
            })
        });
    })
</script>

@endsection
@section('style')
@parent
<link href="{{env('CDN_DOMAIN_NAME')}}/css/waveband.css?v0.0.3" rel="stylesheet">
<link rel="stylesheet" href="{{env('CDN_DOMAIN_NAME')}}/css/clothInfo.css"/>
@endsection